import { useState, useReducer, useCallback } from 'react'

export function useForceUpdate1() {
	const [, setState] = useState(0)

	const update = useCallback(() => {
		setState((preState) => preState + 1)
	}, [])

	return update
}

export function useForceUpdate() {
	const [, setState] = useReducer((x) => x + 1, 0)

	const update = useCallback(() => {
		setState()
	}, [])

	return update
}
